home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 225 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.9 KB  |  61 lines

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Are all Windows programs ill-formed?
  5. Date: 31 Jan 1996 15:50:47 GMT
  6. Organization: SEL
  7. Sender: news@lts.sel.alcatel.de
  8. Approved: clamage@eng.sun.com (comp.std.c++)
  9. Message-ID: <KANZE.96Jan31161809@slsvewt.lts.sel.alcatel.de>
  10. References: <AE5J83na99@qsar.chem.msu.su>
  11. NNTP-Posting-Host: taumet.eng.sun.com
  12. Content-Type: text
  13. In-Reply-To: "Eugene Radchenko"'s message of 29 Jan 1996 10:52:19 PST
  14. Apparently-To: std-c++@ncar.ucar.edu
  15. Content-Length: 2085
  16. X-Lines: 37
  17. Originator: clamage@taumet
  18.  
  19. In article <AE5J83na99@qsar.chem.msu.su> "Eugene Radchenko"
  20. <eugene@qsar.chem.msu.su> writes:
  21.  
  22. |> I have just realized that something is grossly overlooked in C++ standard.
  23. |> It requires every program to have the main() function (which implementation
  24. |> is not allowed to supply) with parameters (void) or (int argc, int*argv[]).
  25. |> However, Windows programs have another convention: prrogram must contain
  26. |> the function
  27. |>   int WinMain(HINSTANCE curInst, HINSTANCE prevInst, LPSTR cmdline, int cmdShow)
  28. |> Some of this is of course quirks or even outright ignored in Win32
  29. |> (prevInst), but the full non-parsed command line could be useful sometimes,
  30. |> and not all implementations provide the function retrieving it. And anyway
  31. |> this is definitely not a main() from the specs. Maybe the requirements on
  32. |> the main() should be relaxed somehow?
  33.  
  34. Implementations are not prevented from having extensions, nor from
  35. requiring non-standard means of getting at those extensions.  A
  36. program without a main (at least in a hosted environment) is
  37. undefined; if the implementation wishes to give it a specific
  38. definition, it is free to do so.
  39.  
  40. What the standard guarantees is what is portable.  If an
  41. implementation wishes to support the above, it can, but it *must*
  42. support the two variants of main described in the standard; if you
  43. want your code to be even slightly portable, then you must provide one
  44. of these variants.  Of course, portability can be compromised by other
  45. things as well.  For example, if you are running under Windows, it is
  46. probable that you also use a number of special library functions that
  47. won't be available on other machines, either.  So it may not
  48. particularly worry you that the absense of a main means that your
  49. program is using a platform specific extension.
  50. --
  51. James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
  52. GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
  53. Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
  54.                 -- A la recherche d'une activitΘ dans une region francophone
  55.  
  56.  
  57. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  58.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  59.   is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
  60.  
  61.